VERSION 5.00
Begin VB.Form frmSetupWRR 
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   2280
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   5505
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   2280
   ScaleWidth      =   5505
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame1 
      BackColor       =   &H00F7D9C2&
      Height          =   2175
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   5295
      Begin VB.CheckBox chkPullOut 
         BackColor       =   &H00F7D9C2&
         Height          =   195
         Left            =   1200
         TabIndex        =   2
         Top             =   660
         Width           =   195
      End
      Begin VB.Frame Frame12 
         BackColor       =   &H00F7D9C2&
         Height          =   75
         Left            =   1140
         TabIndex        =   1
         Top             =   420
         Width           =   4035
      End
      Begin VB.Label Label75 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Use Pull-Out Slip Module on Sales Return"
         Height          =   195
         Left            =   1500
         TabIndex        =   4
         Top             =   660
         Width           =   3195
      End
      Begin VB.Label Label76 
         BackColor       =   &H00F7D9C2&
         Caption         =   "Sales Return"
         Height          =   315
         Left            =   120
         TabIndex        =   3
         Top             =   360
         Width           =   1215
      End
   End
End
Attribute VB_Name = "frmSetupWRR"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Object variables





'Recordset variables
Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1

Public sBit As String

'Security Acess Level variables
Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean

Sub SetDataValue()
    
    'Pull-out slip module on Sales Return
    chkPullOut.Value = GetValue("SR_PULLOUT_WRR", 3)
    
End Sub
Sub SaveChanges()
Set rs = Nothing
Set rs = New ADODB.Recordset
rs.Open "select datepart(yy,getdate()) as dDate", cn, adOpenKeyset, adLockReadOnly

   
    'Pull-out slip module on Sales Return
    SetValue "SR_PULLOUT_WRR", 3, chkPullOut.Value
    lPullOutSlip = chkPullOut.Value
    
     cn.BeginTrans
        rsHeader.UpdateBatch adAffectAll
    cn.CommitTrans
    MsgBox "Record/s successfully saved.", vbInformation, "ComUnion"
    Set rs = Nothing
 End Sub
 
 'Close active window
Public Sub TBCloseWindow()
    Unload Me
End Sub

Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Load()
    Set FrmName = Me
    FormSetup
    
    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'SS03'")

    Set rsHeader = New ADODB.Recordset
    

    If rsHeader.State <> adStateOpen Then
        OpenRecordset rsHeader, "*", "SYSTEM_OPTION"
        SetDataValue
    End If
    
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    
    
    
    
    Set rsHeader = Nothing
    
    Set frmSetupUtil = Nothing
    
    lCloseWindow = True
    CloseMenuTab ITGLedgerMain
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    Set FrmName = Me
    BitVisible ITGLedgerMain.tbrMain, True, True
     sBit = "0000000100001000"
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
End Sub

'Save all changes
Public Sub TBSave()
       SaveChanges
End Sub


Public Function GetValue(param1 As String, param2 As Integer)
On Error GoTo TheSource
    lBoolean = True
    If rsHeader.RecordCount = 0 Then Exit Function
    rsHeader.MoveFirst
    rsHeader.Find ("cCode='" & param1 & "'")
    If param2 = 3 Then
        GetValue = IIf(rsHeader.Fields(3), 1, 0)
    Else
        GetValue = IIf(rsHeader.Fields(4) = Null, "", rsHeader.Fields(4))
    End If
    lBoolean = False
TheSource:
    If lBoolean Then
        If param2 = 3 Then GetValue = False
        If param2 = 4 Then GetValue = ""
    End If
End Function


Sub SetValue(param1 As String, param2 As Integer, param3 As String)
On Error GoTo TheSource
  
    If rsHeader.RecordCount = 0 Then Exit Sub
    rsHeader.MoveFirst
    rsHeader.Find ("cCode='" & param1 & "'")
    If param2 = 3 Then
        rsHeader.Fields(3).Value = IIf(param3 = "0", 0, 1)
    Else
        rsHeader.Fields(4).Value = param3
    End If
TheSource:
    Exit Sub
End Sub


